#/bin/bash

startday=$1
endday=$2
month='12'

for ((day=$startday; day<=$endday; day++)) 
do 
    if [ ${#day} -eq 1 ]; then normalizedDay="0$day"; else normalizedDay=$day; fi
    echo "[info] downloading day $normalizedDay's log ..."
    wget -c ftp://iptv_vis_logbmm:iptv_vis_logbmm@124.108.10.62/Guangzhou/logbmm_2013$month$normalizedDay*.zip
    echo "unziping day $normalizedDay's log... "
    unzip logbmm_2013$month$normalizedDay\*.zip
    cat *.log >> logbmm_2013$month$normalizedDay.merged
    rm -f *.log
    rm -f *.zip
done

